package wisents.wicket.element;

import static junit.framework.Assert.assertEquals;
import org.apache.wicket.markup.html.form.TextField;
import wisents.api.PageElement;

public final class IsTextFieldWithValueElementCriteria extends AbstractWicketElementCriteria {

    private final String textFieldValue;

    public IsTextFieldWithValueElementCriteria(PageElement pageElement, String value) {
        super(pageElement);
        this.textFieldValue = value;
    }

    public void validateCriteria() {
        TextField textField = (TextField) tester.getComponentFromLastRenderedPage(pageElement.path());
        assertEquals(textFieldValue, textField.getValue());
    }

}
